﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Unity.Errors.root;

namespace Unity.Errors.types
{
    public class TException
    {
        #region ctors
        public TException(bool debugOn)
        {
            _DebugOn = debugOn;
        }
        #endregion

        #region properties
        private bool _DebugOn;
        #endregion

        public void Throw(Exception ex, TErrorInfo ei, string msgFormat, params object[] args)
        {
            if (!_DebugOn)
                return;
            string eiPosix =
                String.Format("Exception Thrown!\nNameSpace: {0}\nClass: {1}\nMethod: {2}\n",
                    ei.Namespace, ei.Class, ei.Method);
            MessageBox.Show(String.Format("{0}Native Exception Message: {1}\n{2}\n", eiPosix, ex.Message, String.Format(msgFormat, args)));
            throw ex;
        }

    }
}
